Function: insert(domElementOrMarkupStringOrCSSSelector, domInsertionElement, functionCallback(domElement)) Description: Inserts a DOM element, markup string, or CSS selector referenced element within a target element in the DOM. Returns: domElement, or $A object if chained. Note: Before the new content is inserted into the target DOM element, all preexisting content will be cleaned and removed to prevent memory leaks. Example: // Insert a DOM element within another element targetted with a CSS selector var myElement = $A.insert(domElement, "#myTargetNodeId"); // Insert a markup string element within another DOM element var myElement = $A.insert('
Here we are now, entertain us.
', domElement); // Insert one element referenced by a CSS selector within another DOM element var myElement = $A.insert("#myTargetNodeToMove", domElement); // Insert a DOM element within another DOM element and exicute a callback when done var myElement = $A.insert(domElementToMove, domElementToTarget, function(domElementToMove) { // Do something with domElementToMove after the insertion is complete. }); // Or the same using chaining // Insert a DOM element within another element targetted with a CSS selector var myChain = $A("#myTargetNodeId").insert(domElement); // Insert a markup string element within another DOM element var myChain = $A(domElement).insert('
Here we are now, entertain us.
'); // Insert one element referenced by a CSS selector within another DOM element var myChain = $A(domElement).insert("#myTargetNodeToMove"); // Insert a DOM element within another DOM element and exicute a callback when done var myChain = $A(domElementToTarget).insert(domElementToMove, function(domElementToMove) { // Do something with domElementToMove after the insertion is complete. }); // To return the modified element within a chain, use the "return()" method. var myElement = myChain.return();